package com.yunhe.device.domain.device;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Property;

/**
 * 点表对象
 * @desc 点表对象定义
 * @author liuronglei
 */
@ApiModel(value = "Analog", description = "点表对象")
@NodeEntity
//@QueryResult
public class Analog implements Comparable<Analog> {
    @ApiModelProperty(value = "记录ID")
    @Id
    @GeneratedValue
    private Long id;
    @ApiModelProperty(value = "代码")
    @Property(name = "code")
    private Long code;
    @ApiModelProperty(value = "编号")
    @Property(name = "NAME")
    private String name;
    @ApiModelProperty(value = "标题")
    @Property(name = "title")
    private String title;
    @ApiModelProperty(value = "路径名")
    @Property(name = "pathName")
    private String pathName;
    @ApiModelProperty(value = "设备代码")
    @Property(name = "devCode")
    private Long devCode;
    @ApiModelProperty(value = "点号数据类型代码")
    @Property(name = "MEASUREMENTTYPE")
    private Long typeCode;
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "点号")
    @Property(name = "pointNumber")
    private Long pointNumber;
    @ApiModelProperty(value = "倍率，默认1")
    @Property(name = "transformRatio")
    private Double transformRatio = 1d;
    @ApiModelProperty(value = "端子代码")
    @Property(name = "terminal")
    private String terminal;
    @ApiModelProperty(value = "计算公式")
    @Property(name = "formula")
    private String formula;
    private String type;
    @ApiModelProperty(value = "是否计算")
    private Boolean compute;
    @ApiModelProperty(value = "是否工控机计算")
    private Boolean ipc;
    @ApiModelProperty(value = "采集频率")
    private Long frequency;
    @ApiModelProperty(value = "数据单位")
    private String unit;
    @ApiModelProperty(value = "是否用于展示")
    private Boolean isForShow;
    @ApiModelProperty(value = "上限值")
    private Double upperLimit;
    @ApiModelProperty(value = "下限值")
    private Double lowerLimit;
    @ApiModelProperty(value = "排序字段")
    private String sn;
    @ApiModelProperty(value = "厂房编号")
    @Property(name = "officeName")
    private String officeName;

    @Override
    public int compareTo(Analog o) {
        if (o == null) {
            return 1;
        }
        if (this.sn == null) {
            return -1;
        } else if (o.getSn() == null) {
            return 1;
        }
        return this.sn.compareTo(o.getSn());
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public Boolean getCompute() {
        return compute;
    }

    public void setCompute(Boolean compute) {
        this.compute = compute;
    }

    public Boolean getIpc() {
        return ipc;
    }

    public void setIpc(Boolean ipc) {
        this.ipc = ipc;
    }

    public Long getFrequency() {
        return frequency;
    }

    public void setFrequency(Long frequency) {
        this.frequency = frequency;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getFormula() {
        return formula;
    }

    public void setFormula(String formula) {
        this.formula = formula;
    }

    public Double getTransformRatio() {
        return transformRatio;
    }

    public void setTransformRatio(Double transformRatio) {
        this.transformRatio = transformRatio;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCode() {
        return code;
    }

    public void setCode(Long code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPathName() {
        return pathName;
    }

    public void setPathName(String pathName) {
        this.pathName = pathName;
    }

    public Long getDevCode() {
        return devCode;
    }

    public void setDevCode(Long devCode) {
        this.devCode = devCode;
    }

    public Long getTypeCode() {
        return typeCode;
    }

    public void setTypeCode(Long typeCode) {
        this.typeCode = typeCode;
    }

    public Long getPointNumber() {
        return pointNumber;
    }

    public void setPointNumber(Long pointNumber) {
        this.pointNumber = pointNumber;
    }

    public String getTerminal() {
        return terminal;
    }

    public void setTerminal(String terminal) {
        this.terminal = terminal;
    }

    public Boolean getForShow() {
        return isForShow;
    }

    public void setForShow(Boolean forShow) {
        isForShow = forShow;
    }

    public Double getUpperLimit() {
        return upperLimit;
    }

    public void setUpperLimit(Double upperLimit) {
        this.upperLimit = upperLimit;
    }

    public Double getLowerLimit() {
        return lowerLimit;
    }

    public void setLowerLimit(Double lowerLimit) {
        this.lowerLimit = lowerLimit;
    }

    public String getOfficeName() {
        return officeName;
    }

    public void setOfficeName(String officeName) {
        this.officeName = officeName;
    }
}
